<html>
<head><meta charset="utf-8"><title>librustc linking magic · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/librustc.20linking.20magic.html">librustc linking magic</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="218716449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/librustc%20linking%20magic/near/218716449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Denis Merigoux <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/librustc.20linking.20magic.html#218716449">(Dec 03 2020 at 16:14)</a>:</h4>
<p>Hi everyone, I'm doing a project based on the Rust compiler using <code>#![feature(rustc_private)]</code> to access the compiler API. It works nice except that we have to set <code>LD_LIBRARY_PATH</code> to the folder where the <code>librustc</code> shared library is. I noticed that <code>clippy</code> does not need to find this dynamic library all the time. Does it mean that it's statically linked to <code>librustc</code> ? I tried hard to look for clues in the <a href="https://github.com/rust-lang/rust-clippy/">https://github.com/rust-lang/rust-clippy/</a> <code>build.rs</code> or <code>Cargo.toml</code> but couldn't find anything unusual, so it looks like magic to me :)</p>



<a name="218716608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/librustc%20linking%20magic/near/218716608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vn-ki <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/librustc.20linking.20magic.html#218716608">(Dec 03 2020 at 16:16)</a>:</h4>
<p>I may be wrong, but this might be the clippy you are looking for: <a href="https://github.com/rust-lang/rust/tree/master/src/tools/clippy">https://github.com/rust-lang/rust/tree/master/src/tools/clippy</a></p>
<p>edit: oh well, they look the same. i do not know then :)</p>



<a name="218717239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/librustc%20linking%20magic/near/218717239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/librustc.20linking.20magic.html#218717239">(Dec 03 2020 at 16:20)</a>:</h4>
<p><span class="user-mention" data-user-id="127968">@Denis Merigoux</span> It is linked dynamically.  Depending on the circumstance, <code>LD_LIBRARY_PATH</code> is set by either rustup or cargo.</p>



<a name="218717921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/librustc%20linking%20magic/near/218717921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Denis Merigoux <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/librustc.20linking.20magic.html#218717921">(Dec 03 2020 at 16:25)</a>:</h4>
<p>Thanks for the confirmation!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>